# include <bits/stdc++.h>
using namespace std;
int ip[501], n;
inline bool inp(int x) { 
    int l = 1, r = 500, mid;
    while(l < r) { 
        mid = ((l + r) >> 1);
        if(x <= ip[mid]) r = mid;
        else l = mid + 1;
    }
    return ip[l] == x;
}
int main() { 
# ifndef LOCAL
    freopen("squares.in", "r", stdin);
    freopen("squares.out", "w", stdout);
# endif
    scanf("%d", &n);
    for(int i = 1; i <= 500; i++) ip[i] = i * i;
    int ans = 0;
    for(int i = 1; i <= 500; i++) { 
        if(inp(i * i + n)) ans++;
    }
    printf("%d", ans);
}
